//
//  MainTabBarController.m
//  乐账
//
//  Created by 谢毅 on 17/1/17.
//  Copyright © 2017年 xieyi. All rights reserved.
//

#import "MainTabBarController.h"

@interface MainTabBarController ()

@end

@implementation MainTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self addChildViewControllers];
}
/// 添加所需的控制器
-(void)addChildViewControllers{
    
    [self addChildViewController:[[ViewController alloc] init] Title:@"应用首页" ImageName:@"tabbar_home"];
    [self addChildViewController:[[MessageTableViewController alloc] init] Title:@"应用消息" ImageName:@"tabbar_message_center"];
    [self addChildViewController:[[DiscoverTableViewController alloc] init] Title:@"应用发现" ImageName:@"tabbar_discover"];
    [self addChildViewController:[[ProfileTableViewController alloc] init] Title:@"个人" ImageName:@"tabbar_profile"];
    
    
}
/// 添加单个控制器
///
/// @param vc        控制器
/// @param title     控制器标题
/// @param imageName 控制器对应图标
-(void)addChildViewController:(UIViewController *)vc Title:(NSString *)title ImageName:(NSString *)imageName{
    
    vc.title = title;
    vc.tabBarItem.image = [UIImage imageNamed:imageName];
    //设置控制器导航条
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
    [self addChildViewController:nav];
}

@end
